using UnityEngine;

namespace ProceduralPrimitivesUtil
{
	public class Plane : PPBase
	{
		[Header("Basic parameters")]
		public float width = 2f;

		public float length = 2f;

		[Header("Segments")]
		public int widthSegs = 10;

		public int lengthSegs = 10;

		[Header("Mapping Coordinates")]
		public bool generateMappingCoords = true;

		public bool realWorldMapSize;

		public Vector2 UVOffset = new Vector2(0f, 0f);

		public Vector2 UVTiling = new Vector2(1f, 1f);

		[Header("Others")]
		public bool flipNormals;

		protected override void CreateMesh()
		{
			m_mesh.name = "Plane";
			length = Mathf.Clamp(length, 1E-05f, 10000f);
			width = Mathf.Clamp(width, 1E-05f, 10000f);
			lengthSegs = Mathf.Clamp(lengthSegs, 1, 100);
			widthSegs = Mathf.Clamp(widthSegs, 1, 100);
			CreatePlane(pivotOffset + Vector3.zero, m_rotation * Vector3.forward, m_rotation * Vector3.right, width, length, widthSegs, lengthSegs, generateMappingCoords, realWorldMapSize, UVOffset, UVTiling, flipNormals);
		}
	}
}
